#ifndef WORK_THREAD_H
#define WORK_THREAD_H
#include<QTcpSocket>
#include<QThread>
#include<QDebug>
#include <QTcpSocket>
#include <QQueue>

//1 继承QThread
class WorkThread : public QThread
{
    Q_OBJECT
public:
    WorkThread( );
    void  setParam(const QString & ip ,quint16 port );
 signals:
      //自定义信号，线程内发送，传递给外面的Widgets 在界面上显示
      void  sigPrint(const QString & info,  bool conn=true);
 protected:
      //2重写run
      virtual void run()  override;
private:

    QTcpSocket  *m_tcpClient;
    QString ip;
    quint16 port;
 public:
    volatile  bool bRun;//是否继续运行
    //使用一个队列保存要发送的数据
    QQueue<QByteArray>  que;
};

#endif // RECVTHREAD_H
